//
//  HomeTableViewCell.m
//  喜马拉雅首页
//
//  Created by dllo on 15/12/21.
//  Copyright © 2015年 刘倩男. All rights reserved.
//

#import "HomeTableViewCell.h"
#import "HomeCollectionViewCell.h"
@interface HomeTableViewCell ()<UICollectionViewDataSource, UICollectionViewDelegate>
@property (nonatomic, retain) UICollectionView *myCollectionV;
@property (nonatomic, retain) UIImageView *imageView1; // 小三角形
@property (nonatomic, retain) UILabel *titleLabel;
@property (nonatomic, retain) UILabel *moreLabel;
@property (nonatomic, retain) UIImageView *imageView2; // 更多的小三角形
@end
@implementation HomeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCollectionView];
    }
    return self;
}

- (void)createCollectionView{
    
    self.imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 15, 15)];
    self.imageView1.image = [UIImage imageNamed:@"liveRadioCellPoint@2x.png"];
    [self addSubview:self.imageView1];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, -8, 100, 50)];
    self.titleLabel.text = @"猜你喜欢";
    [self addSubview:self.titleLabel];
    
    self.moreLabel = [[UILabel alloc] initWithFrame:CGRectMake(350, -8, 100, 50)];
    self.moreLabel.text = @"更多";
    self.moreLabel.textColor = [UIColor grayColor];
    self.moreLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.moreLabel];
    
    self.imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(380, 10, 15, 15)];
    self.imageView2.image = [UIImage imageNamed:@"cell_arrow@2x.png"];
    [self addSubview:self.imageView2];
    
    
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
    self.myCollectionV = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 30, 414, 170) collectionViewLayout:flowLayout];
    self.myCollectionV.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.myCollectionV];
    
    self.myCollectionV.delegate = self;
    self.myCollectionV.dataSource = self;
    
    flowLayout.itemSize = CGSizeMake(110, 110);
    flowLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 20);
    flowLayout.minimumInteritemSpacing = 5.0;
    
    
    
    [self.myCollectionV registerClass:[HomeCollectionViewCell class] forCellWithReuseIdentifier:@"cellC"];
    
    UIImageView *imageViewFoot = [[UIImageView alloc] initWithFrame:CGRectMake(0, 199, 414, 20)];
    imageViewFoot.image = [UIImage imageNamed:@"cell_bg_bottom_h@2x.png"];
    [self addSubview:imageViewFoot];
    
}



- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 3;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    HomeCollectionViewCell *cellC = [collectionView dequeueReusableCellWithReuseIdentifier:@"cellC" forIndexPath:indexPath];
    return cellC;
}


@end
